import { createApp } from "vue";
import App from "./App.vue";
import "./registerServiceWorker";
import "@/assets/index.scss";
import "@/assets/css/common.scss";
import "@/assets/css/reset.css";
import ElementPlus from "element-plus";
import "element-plus/lib/theme-chalk/index.css";
import router from "./router";
import store from "./store";
import draggable from "vuedraggable";
import registerComponent from "@/utils/schemaRegister.js";

const app:any = createApp(App);
app.use(ElementPlus, {});
app.component("draggable", draggable);

app.provide("axios", () => console.log("axios111方法"));

// window[`idmApp`] = app
function registerCom(ary: []) {
  ary.forEach((key: any) => {
    app.component(key.name, key.component);
  });
}
// 注册全局组件
registerCom(registerComponent.$register);
registerCom(registerComponent.$registerGlobal);
registerCom(registerComponent.$registerComponent);

app.config.globalProperties = {
  $imgPrefix: "/nrms",
  $http: () => console.log("这是全局方法$http"),
};

app.use(store).use(router).mount("#app");
